package com.sneaker.shower.entity.enums;

import java.util.Arrays;
import java.util.Objects;

/**
 * Created by lopo on 2019/9/1.
 */
public enum KuaiDiCompanyEnum {

    defaults("default", "智能识别"),
    shunfeng("shunfeng", "顺丰"),
    ems("ems", "EMS"),
    youzhengguonei("youzhengguonei", "邮政包裹"),
    huitongkuaidi("huitongkuaidi", "百世汇通"),
    shentong("shentong", "申通"),
    zhongtong("zhongtong", "中通"),
    yuantong("yuantong", "圆通"),
    guotongkuaidi("guotongkuaidi", "国通"),
    yunda("yunda", "韵达"),
    tiantian("tiantian", "天天"),
    youshuwuliu("youshuwuliu", "优速"),
    kuaijiesudi("kuaijiesudi", "快捷"),
    quanfengkuaidi("quanfengkuaidi", "全峰"),
    jd("jd", "京东"),
    zhaijisong("zhaijisong", "宅急送"),

    ;
    private String code;
    private String name;

    KuaiDiCompanyEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public static KuaiDiCompanyEnum getByCode(String code) {
        return Arrays.asList(KuaiDiCompanyEnum.values())
                .stream().filter(kuaiDiCompanyEnum -> Objects.equals(kuaiDiCompanyEnum.getCode(), code))
                .findFirst().orElse(KuaiDiCompanyEnum.defaults);
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }
}
